#include "ej_bsp_uart.h"
#include "board_includes.h"
/* private define -------------------------------------------------------- */
#define UART_RX_DEBUG_EN	0
/* private function prototypes ---------------------------------------------- */


/* private variables -------------------------------------------------------- */


/* private function ---------------------------------------------- */
static bool bsp_hw_uart_init(bsp_uart_t *handle)
{


	return TRUE;
}

static uint32_t bsp_hw_uart_send_bytes(bsp_uart_t *handle, uint8_t *buf, uint32_t size)
{

}

static uint32_t bsp_hw_uart_read_bytes(bsp_uart_t *handle, uint8_t *buf, uint32_t size)
{

}

/* public function ---------------------------------------------- */
bool ej_bsp_uart_init(bsp_uart_t *handle, const uart_cfg_t *cfg, ej_uart_mode_e mode)
{
	bool ret = FALSE;
	if ((handle == NULL) || (cfg == NULL))
	{
		return FALSE;
	}
	handle->cfg = cfg;
	handle->mode = mode;
	handle->uart_init_flag = TRUE;

	if (mode == EJ_UART_MODE_SIM)
	{

	}
	else
	{
		ret = bsp_hw_uart_init(handle);
	}

	if (ret)
	{
		printf("Uart Init Successful : %s !!\n", handle->cfg->name);
	}
	else
	{
		printf("Uart Init Failed : %s !!\n", handle->cfg->name);
	}
	return TRUE;
}

uint32_t ej_bsp_uart_send_bytes(bsp_uart_t *handle, uint8_t *buf, uint32_t size)
{
	uint32_t ret = 0;

	if ((handle == NULL) || (!handle->uart_init_flag))
	{
		return 0;
	}

	if (handle->mode == EJ_UART_MODE_SIM)
	{

	}
	else
	{
		ret = bsp_hw_uart_send_bytes(handle, buf, size);
	}

	return ret;
}

uint32_t ej_bsp_uart_read_bytes(bsp_uart_t *handle, uint8_t *buf, uint32_t size)
{
	uint32_t ret = 0;

	if ((handle == NULL) || (!handle->uart_init_flag))
	{
		return 0;
	}

	if (handle->mode == EJ_UART_MODE_SIM)
	{

	}
	else
	{
		ret = bsp_hw_uart_read_bytes(handle, buf, size);
	}

	return ret;
}

